import axios from "axios";
import Result from "@/ts/returnType.ts";
import {SupervisionDataDto} from "@/ts/entityTypes.ts";

const getSupervisionDataApi = (params: object) : Promise<Result> => {
    return axios({
        url: '/supervisionData',
        method: 'get',
        params
    })
}

const getSupervisionDataByIdApi = (id: string) : Promise<Result> => {
    return axios({
        url: `/supervisionData/${id}`,
        method: 'get'
    })
}

const getInspectorListApi = (params: object) : Promise<Result> => {
    return axios({
        url: '/supervisionData/inspectors',
        method: 'get',
        params
    })
}

const assignInspectorApi = (data: SupervisionDataDto, inspectorId: string) : Promise<Result> => {
    return axios({
        url: `/supervisionData/assign/${inspectorId}`,
        method: 'post',
        data
    })
}

export { getSupervisionDataApi, getSupervisionDataByIdApi, getInspectorListApi , assignInspectorApi}
